#include <iostream>
#include <string>
#include <unistd.h>
#include <pzmq.hpp>
#include <pzmq_data.h>

std::string test_func1(pzmq *self, const std::shared_ptr<pzmq_data> &msg)
{
    std::string raw_msg = msg->String();

    std::cout << "Raw data (hex): ";
    for (char c : raw_msg)
    {
        printf("%02X ", static_cast<unsigned char>(c));
    }
    std::cout << std::endl;

    std::string param0 = msg->GetParam(0);
    std::string param1 = msg->GetParam(1);

    std::cout << "fun1 received: param0=" << param0 << ", param1=" << param1 << std::endl;

    return pzmq_data::SetParam("get", "message");
}

int main()
{
    pzmq rpc("test");
    rpc.RegisterRpcAction("test_func", test_func1);
    while(true)
    {
        sleep(1);
    }
    return 0;
}